<!doctype html>
<html>
<head>
    <title>美国易安友|登录</title>
<include file="public:headtop" />
<link href="/static/css/login.css" rel="stylesheet">
</head>

<body>
	<div class="logo-box">
        <a href="{:U('Index/index')}"><img src="/static/images/logo02.png" alt="logo"></a>
    </div>
    <form class="login-box" method="post">
    	<div class="uers-box">
        	<div class="img-box"><img src="/static/images/img19.png" alt="icon"></div>
            <input type="text" id="user_name" placeholder="用户名">
        </div>
        <div class="password-box">
        	<div class="img-box"><img src="/static/images/img20.png" alt="icon"></div>
            <input type="password" id="password" placeholder="密  码">
        </div>
<!--        <div class="img-box02">
        	<img src="images/img21.png" alt="icon">
        </div>
        <div class="img-box03">
        	<img src="images/img22.png" alt="icon">
        </div>-->
    </form>
    <div class="text-box"><a href="{:U('User/forgetpass')}">忘记密码？</a></div>
    <div class="btn-box">
    	<button type="submit" class="btn btn01">登录</button>
        <a href="{:U('User/register')}" class="btn btn02">注册</a>
    </div>
    <script>
		/*用于绑定移动端点击事件*/
		document.body.addEventListener('touchstart', function () {});
//		$('#a2').click(function(){
//			$('#b2').trigger('click');
//		});
		
		$(function(){
//			$('a.btn02').click(function(){
//				location.href="{:U('User/register')}";
//				return false;
//			});
			$('button.btn01').click(function(){
				var user_name= $('#user_name').val();
				var password= $('#password').val();

                if(user_name == "" || password == "") {
                    alert("用户名和密码不能为空");
                    return false;
                }
				
				var url  = "{:U('Index/ajaxlogin')}";
				$.post(url,{user_name:user_name,password:password},function(data){
				
					if(data.status==1) {
						location.href="{:U('User/index')}";
					} else {
						alert("密码错误！");
						return false;
					}

				},'json');
			}); 
		});  
	</script>
</body>
</html>